home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
MiscKit1.7.1
/
MiscKit
/
Palettes
/
MiscArrowButtonPalette
/
ABInspector.m
< prev
next >
Wrap
Text File
|
1995-04-12
|
3KB
|
143 lines
// Copyright (C) 1995 Robert Todd Thomas
// Use is governed by the MiscKit license
#import "MiscArrowButton.subproj/MiscArrowButton.h"
#import "ABInspector.h"
@implementation ABInspector
// Load the Inspector
- init
{
char buf[MAXPATHLEN + 1];
id bundle;
[super init];
bundle = [NXBundle bundleForClass:[MiscArrowButton class]];
[bundle getPath: buf forResource: "MiscABInspector" ofType:"nib"];
[NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
return self;
}
// This method sets all the values in the inspector by getting
// the relevant info from the object. This is called when the
// inspector first appears, so the object's attributes are
// correctly displayed in the inspector.
- revert: sender
{
// set all the options
[ [optionMatrix cellAt: 0 : 0] setState: [object isBordered] ];
[ [optionMatrix cellAt: 1 : 0] setState: [object isTransparent] ];
[ [optionMatrix cellAt: 2 : 0] setState: [object isContinuous] ];
[ [optionMatrix cellAt: 3 : 0] setState: ![object isEnabled] ];
[ [optionMatrix cellAt: 4 : 0] setState: [object state] ];
// set the title, altTitle, and sound in the inspector
[tagField setIntValue: [object tag] ];
[titleField setStringValue: [object title] ];
[altTitleField setStringValue: [object altTitle] ];
[soundField setStringValue: [ [object sound] name] ];
[optionMatrix display];
[alignButton setState: [object arrowAlignment] ];
return [super revert: sender];
}
// One of the checkbox buttons was clicked, so change the corresponding
// attribute of the object being inspected.
- optionsChanged:sender
{
id cell = [sender selectedCell];
BOOL state = [cell state];
switch ([cell tag])
{
case 0: // bordered
[object setBordered: state];
break;
case 1: // transparent
[object setTransparent: state];
break;
case 2: // continuous
[object setContinuous: state];
break;
case 3: // disabled
[object setEnabled: !state];
break;
case 4: // selected
[object setState: state];
break;
}
return [super ok: sender];
}
- tagChanged: sender
{
[object setTag: [sender intValue] ];
return [super ok: sender];
}
- titleChanged: sender
{
[object setTitle: [sender stringValue] ];
return [super ok: sender];
}
- altTitleChanged: sender
{
[object setAltTitle: [sender stringValue] ];
return [super ok: sender];
}
- soundChanged: sender
{
[object setSound: [Sound findSoundFor: [sender stringValue] ] ];
return [super ok: sender];
}
- alignmentChanged: sender
{
[object setArrowAlignment: [sender state] ];
return [super ok: sender];
}
- (BOOL)wantsButtons
{
return NO;
}
@end